<?php 

// src/Acme/StoreBundle/Entity/Post.php
namespace Acme\StoreBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection; 

use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Table(name="post")
 * @ORM\Entity
 */

class Post
{
    /**
     * @ORM\Column(type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * @ORM\Column(type="string", length=100)
     */
    protected $title;

    /**
     * @ORM\Column(type="text")
     */
    protected $content;
    
    /**
     * @ORM\Column(type="boolean", options={"default" = 1}, nullable=true)
     */
    protected $is_display;
    
    /**
     * @ORM\Column(type="datetime", nullable=true)
     */
    protected $created_date;
        
    /**
     * @ORM\ManyToOne(targetEntity="Acme\StoreBundle\Entity\User", inversedBy="posts")
     * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
     */
    protected $user;
    
    /**
     * @ORM\OneToMany(targetEntity="Acme\StoreBundle\Entity\Comment", mappedBy="post")
     */
    protected $comments;
    
    public function __construct()
    {
        $this->entityname = 'Post';
        $this->comments = new ArrayCollection();
    }
    
    
    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set title
     *
     * @param string $title
     * @return Post
     */
    public function setTitle($title)
    {
        $this->title = $title;

        return $this;
    }

    /**
     * Get title
     *
     * @return string 
     */
    public function getTitle()
    {
        return $this->title;
    }

    /**
     * Set content
     *
     * @param string $content
     * @return Post
     */
    public function setContent($content)
    {
        $this->content = $content;

        return $this;
    }

    /**
     * Get content
     *
     * @return string 
     */
    public function getContent()
    {
        return $this->content;
    }

    /**
     * Set is_display
     *
     * @param boolean $isDisplay
     * @return Post
     */
    public function setIsDisplay($isDisplay)
    {
        $this->is_display = $isDisplay;

        return $this;
    }

    /**
     * Get is_display
     *
     * @return boolean 
     */
    public function getIsDisplay()
    {
        return $this->is_display;
    }

    /**
     * Set created_date
     *
     * @param \DateTime $createdDate
     * @return Post
     */
    public function setCreatedDate($createdDate)
    {
        $this->created_date = $createdDate;

        return $this;
    }

    /**
     * Get created_date
     *
     * @return \DateTime 
     */
    public function getCreatedDate()
    {
        return $this->created_date;
    }

    /**
     * Set user
     *
     * @param \Acme\StoreBundle\Entity $user
     * @return Post
     */
    public function setUser(\Acme\StoreBundle\Entity\User $user = null)
    {
        $this->user = $user;

        return $this;
    }

    /**
     * Get user
     *
     * @return \Acme\StoreBundle\Entity 
     */
    public function getUser()
    {
        return $this->user;
    }

    /**
     * Add comments
     *
     * @param \Acme\StoreBundle\Entity\Comment $comments
     * @return Post
     */
    public function addComment(\Acme\StoreBundle\Entity\Comment $comments)
    {
        $this->comments[] = $comments;

        return $this;
    }

    /**
     * Remove comments
     *
     * @param \Acme\StoreBundle\Entity\Comment $comments
     */
    public function removeComment(\Acme\StoreBundle\Entity\Comment $comments)
    {
        $this->comments->removeElement($comments);
    }

    /**
     * Get comments
     *
     * @return \Doctrine\Common\Collections\Collection 
     */
    public function getComments()
    {
        return $this->comments;
    }
}
